package com.shou.types.exception;

import com.shou.types.common.ReturnCodeEnum;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * ClassName:ExternalException
 * Project:SmartPark
 * Package: com.shou.types.exception
 * Description
 *
 * @Author Nemo
 * @Create 2025/3/24 13:22
 * @Version 1.0
 */
public class ExternalException extends BaseException{
    @Getter
    @AllArgsConstructor
    public enum ErrorCodeEnum {
        USER_NAME_NOT_FOUND("B-CLI-01-01", "用户名不存在！"),
        GENERATE_KEY_PAIR_FAILED("B-CRYPT-01-01", "生成数据加密公钥和数据解密私钥失败"),
        ENCRYPT_WITH_PUBLIC_KEY_FAILED("B-CRYPT-02-01", "公钥加密失败"),
        DECRYPT_WITH_PRIVATE_KEY_FAILED("B-CRYPT-02-02", "私钥解密失败");

        private final String errorCode;
        private final String message;
    }

    public ExternalException(ExternalException.ErrorCodeEnum errorCodeEnum, String description, ReturnCodeEnum httpStatus) {
        super(errorCodeEnum.getErrorCode(), errorCodeEnum.getMessage() + description, httpStatus);
    }
    public ExternalException(ExternalException.ErrorCodeEnum errorCodeEnum, ReturnCodeEnum httpStatus) {
        super(errorCodeEnum.getErrorCode(), errorCodeEnum.getMessage(), httpStatus);
    }
}
